package com.example.demo6.SQLite;

import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.Query;
import androidx.room.Update;

@Dao
public interface UserDao {
    @Insert
    void insertUser(User user);
    @Delete
    void deleteUser(User user);
    @Update
    void updateUser(User user);

    @Query("select * from User where userid=:userid")
    User getUserByUserId(int userid);

    @Query("SELECT * FROM User WHERE username = :username AND password = :password")
    User getUserByUsernameAndPassword(String username, String password);

    @Query("insert into User values (:userid,:username,:password,:phone,:region)")
    void insertUserByUser(int userid,String username,String password,long phone,String region);

    @Query("SELECT * FROM User WHERE username = :username")
    User getUserByUsername(String username);

}

